package jobOO2;

public class Person {
    String name;
    int age;
    String address;
    Person(String name,int age,String address){
        this.name=name;
        this.age=age;
        this.address=address;

    }
    void eat(){
        System.out.println(name+"正在吃饭...");
    }
    void sleep(){
        System.out.println(name+"正在睡觉...");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，我今年"+age+"岁了，我住在"+address);
    }
}
  class Student extends Person{
    String className;
    String stuId;
    Student(String name,int age,String address,String className,String stuId){
        super(name,age,address);
        this.className=className;
        this.stuId=stuId;
    }
    void study(){
        System.out.println(name+"在学习");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，我今年"+age+"岁了，我住在"+address
                +"我的班级是："+className+"，我的学号是："+stuId);
    }

  }

  class Teacher extends Person{
    double salary;
    Teacher(String name,int age,String address,double salary){
        super(name,age,address);
        this.salary=salary;
    }
    void teach(){
        System.out.println(name+"正在讲课...");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，我今年"+age+"岁了，我住在"+address
                +"月薪："+salary);
    }
  }

  class Doctor extends Person{
    String title;
    Doctor(String name,int age,String address,String title){
        super(name,age,address);
        this.title=title;
    }
    void cut(){
        System.out.println(name+"正在坐诊...");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，我今年"+age+"岁了，我住在"+address
                +"，任职于一家医院的"+title);
    }
  }